function Test-IPInRange {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)][string]$FromIPAddress,
        [Parameter(Mandatory = $true)][string]$ToIPAddress,
        [Parameter(Mandatory = $true)][string]$IPAddress
    )

    $FromIP = [system.net.ipaddress]::Parse($FromIPAddress).GetAddressBytes()
    [array]::Reverse($FromIP)
    $FromIP = [system.BitConverter]::ToUInt32($FromIP, 0)

    $ToIP = [system.net.ipaddress]::Parse($ToIPAddress).GetAddressBytes()
    [array]::Reverse($ToIP)
    $ToIP = [system.BitConverter]::ToUInt32($ToIP, 0)

    $IP = [system.net.ipaddress]::Parse($IPAddress).GetAddressBytes()
    [array]::Reverse($IP)
    $IP = [system.BitConverter]::ToUInt32($IP, 0)

    return (($IP -ge $FromIP) -and ($IP -le $ToIP))
}